package javafx.demo.text;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.paint.CycleMethod;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class TestText extends Application {

	public static void main(String[] args) {
		launch(args);
	}

	@Override
	public void start(Stage stage) {
		stage.setTitle("TitledPane");
		Scene scene = new Scene(new VBox(), 800, 250);
		scene.setFill(Color.GHOSTWHITE);

		Text t1 = text1();

		Text t2 = text2();

		VBox root = (VBox) scene.getRoot();
		root.getChildren().addAll(t1,t2);
		stage.setScene(scene);
		stage.show();
	}

	private Text text2() {
		Text text = new Text("Stroke and Fill");
		text.setFont(Font.font("Tahoma", 100));
		text.setFill(new LinearGradient(0, 0, 1, 2, true, CycleMethod.REPEAT, new Stop[] { new Stop(0, Color.AQUA),
				new Stop(0.5f, Color.RED) }));
		text.setStrokeWidth(1);
		text.setStroke(Color.BLACK);
		return text;
	}

	private Text text1() {
		Text t = new Text();
		t.setText("This is a text sample");
		t.setFont(Font.font("Verdana", 20));
		t.setFill(Color.RED);
		return t;
	}
}
